home *** CD-ROM | disk | FTP | other *** search
/ New Perspectives on Computer Concepts / New Perspectives on Computer Concepts.iso / np2010c / page778.pag < prev    next >
Portable Network Graphic  |  2008-10-02  |  91KB  |  817x1045  |  8-bit (256 colors)
Labels: book | chat room | crt screen | hakham | monitor | sky
OCR: 710 SECTION c CHAPTER 1.2 How does Java program work? The computer begins executing Java program by locating standard method called main which contains code to send messages to objects by calling methods. For the pizza pro- gram, the main() method includes code that defines few variables and then asks the user to enter the shape of the first pizza. If the shape entered Round the program creates an object called Pizza1 that is member of the RoundPizza class. If the shape entered is Rectangle, the program cre- ates an object called Pizza1 that is member of the RectanglePizza class After the pizza object created, the program uses the getArea) method to calculate its area The program then uses the getSquarelnchPrice method to calculate the pizza's square-inch price When the calculations are co ...